<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
onMounted(() => {
  router.push('/infoShow');
});
const router = useRouter();

// 当前选中的菜单项
const activeItem = ref('personalcenter');

// 改变选中状态的方法
const changePersonalCenter = () => {
  activeItem.value = 'personalcenter';
  router.push('/infoShow');
};

const changeInfo = () => {
  activeItem.value = 'Info';
  router.push('/info');
};

const changePwd = () => {
  activeItem.value = 'updatePwd';
  router.push('/updatePwd');
};

</script>
<template>
  <div  class="bg">
    <div class="user-info-row-top">
    <div class="grid-content">首页>鲜花>个人中心</div>
  </div>
  <div class="user-info-row-bottom">
    <div class="bottom-left">
      <div 
        class="personalcenter" 
        @click="changePersonalCenter"
        :class="{ 'active': activeItem == 'personalcenter' }"
      >
        <img 
          :src="activeItem == 'personalcenter' ? '../src/assets/images/personalcenter2.png' : '../src/assets/images/personalcenter1.png'" 
          style="width: 20px; height: 20px;" 
        >
        <div>个人中心</div><br>
      </div>
      <div class="setting">
        <div class="setting-item">
          <img src="../assets/images/setting1.png" style="width: 20px; height: 20px;" alt="">
          <div>账号设置</div>
        </div>
        <div 
          class="setting-item1"
          :class="{ 'active': activeItem == 'Info' }"
          @click="changeInfo"
        >
          个人信息
        </div>
        <div 
          class="setting-item1"
          :class="{ 'active': activeItem == 'updatePwd' }"
          @click="changePwd"
        >
          修改密码
        </div>
      </div>
    </div>
    <div class="bottom-right">
      <router-view></router-view>
    </div>
  </div>
  </div>

</template>
<style>
.bg{
  background-color:rgb(243, 241, 241);
  padding-bottom: 20px;
  
}
.user-info-row-top {
  width: 100%;
  height: 25px;
  
}
.grid-content {
  width: 100%;
  font-size: 16px;
  margin-left: 150px;
}

.user-info-row-bottom {
  width: 100%;
  min-height: 550px;
  display: flex;
  align-items: flex-start;
}

.bottom-left {
  width: 190px;
  min-height: 450px;
  background-color: #ffffff;
  margin-left: 150px;
}

.personalcenter {
  width: 80%;
  height: 50px;
  margin-left: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.personalcenter.active {
  color: #e9a63a9a;
  font-weight: bold;
}

.setting{
  width: 80%;
  height: 130px;
  margin-left: 15px;
  border-top: 2px dashed #565151;
  border-bottom: 2px dashed #565151;
}

.setting-item{
  display: flex;
  margin-top: 20px;
  align-items: center;
  justify-content: center;
}

.setting-item1 {
  width: 70%;
  height: 20px;
  font-size: 14px;
  margin-top: 10px;
  margin-left: 70px;
  cursor: pointer;
}

.setting-item1.active {
  color: #e9a63a9a;
  font-weight: bold;
}

.bottom-right {
  width: 980px;
  min-height: 450px;
  background-color: #ffffff;
  margin-left: 20px;
  flex-grow: 1;
  height: auto;
  }
</style>